﻿using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Use arrow keys to operate the number. Press [Ctrl + C] to exit.");
            int i = 0;
            Console.WriteLine(value: i.ToString());
            for (; ; )
            {
                ConsoleKeyInfo input = Console.ReadKey(intercept: true);
                //Console.WriteLine(input.Key.ToString());
                switch (input.Key)
                {
                    case ConsoleKey.UpArrow:
                    case ConsoleKey.RightArrow:
                        i++;
                        Console.ForegroundColor = ConsoleColor.Green;
                        break;
                    case ConsoleKey.DownArrow:
                    case ConsoleKey.LeftArrow:
                        i--;
                        Console.ForegroundColor = ConsoleColor.Red;
                        break;
                    default:
                        break;
                }
                Console.WriteLine(value: i.ToString());
            }
        }
    }
}
